package net.angrynut.web.configuration;

import com.google.common.collect.ImmutableSet;
import net.angrynut.web.model.converter.StringToDateConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ConversionServiceFactoryBean;
import org.springframework.core.convert.ConversionService;

@Configuration
public class BeanDefinations {

    @Bean
    public ConversionService conversionService() {
        ConversionServiceFactoryBean bean = new ConversionServiceFactoryBean();
        bean.setConverters(ImmutableSet.of(new StringToDateConverter()));
        bean.afterPropertiesSet();
        return bean.getObject();
    }
}
